package com.algorithm;

/**
 * @author: sun.hongliang
 * @create: 2019/11/16 14:18
 */
public class RemoveElements {
    public static void main(String[] args) {


    }

    public ListNode removeElements(ListNode head, int val) {
        ListNode h = new ListNode(0);
        h.next = head;
        ListNode p = h;
        while (p.next != null) {
            if (p.next.val == val) {
                p.next = p.next.next;
                continue;
            }
            p = p.next;
        }
        return h.next;
    }
}
